#!/bin/sh
B=$(dirname $(realpath $0))
set -x
set -e
MAJOR=5
MINOR=12
REV=9
#VER=5124
VER=${MAJOR}${MINOR}${REV}
VERSION=${MAJOR}.${MINOR}.${REV}
PKG=$(cat ${B}/qt${VER}-linux-packages)

mkdir -p /opt/qt/
(
cd /opt/qt &&
wget ${PKG} &&
for f in *; do 7z x $f > /dev/null; done &&
cat <<EOF > ${VERSION}/gcc_64/bin/qt.conf
[Paths]
Prefix=..
EOF
sed -i -r 's/QT_EDITION = Enterprise/QT_EDITION = OpenSource/' ${VERSION}/gcc_64/mkspecs/qconfig.pri 
sed -i -r 's/QT_LICHECK = lichec.*/QT_LICHECK = /' ${VERSION}/gcc_64/mkspecs/qconfig.pri 
)
